<article class="" id="post-">
<header class="entry-header">
<h1 class="entry-title">jQuery.speed</h1>
<div class="entry-meta">
						所属分类：<span class="category"><a href="/category/effects/">特效</a> &gt; <a href="/category/effects/custom-effects/">自定义</a></span>
<span class="pull-right">英文文档：<a href="https://api.jquery123.com/jQuery.speed/" target="_blank">jQuery.speed</a></span>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<article class="entry method" id="jQuery-speed1"><h2 class="section-title">
<span class="name">jQuery.speed(  [duration ] [, settings ] )</span><span class="returns">Returns: <a href="http://api.jquery.com/Types/#PlainObject">PlainObject</a></span>
</h2>
<div class="entry-wrapper">
<p class="desc"><strong>Description: </strong>Creates an object containing a set of properties ready to be used in the definition of custom animations.</p>
<ul class="signatures">
<li class="signature">
<h4 class="name">
<span class="version-details">version added: <a href="/category/version/1.0/">1.0</a></span><a href="#jQuery-speed-duration-settings" id="jQuery-speed-duration-settings"><span class="icon-link"></span>jQuery.speed(  [duration ] [, settings ] )</a>
</h4>
<ul>
<li>
<div>
<strong>duration</strong> (default: <code>400</code>)</div>
<div>Type: <a href="http://api.jquery.com/Types/#Number">Number</a> or <a href="http://api.jquery.com/Types/#String">String</a>
</div>
<div>A string or number determining how long the animation will run.</div>
</li>
<li>
<div><strong>settings</strong></div>
<div>Type: <a href="http://api.jquery.com/Types/#PlainObject">PlainObject</a>
</div>
<div></div>
<ul>
<li>
<div>
<strong>easing</strong> (default: <code>swing</code>)</div>
<div>Type: <a href="http://api.jquery.com/Types/#String">String</a>
</div>
<div>A string indicating which easing function to use for the transition.</div>
</li>
<li>
<div><strong>complete</strong></div>
<div>Type: <a href="http://api.jquery.com/Types/#Function">Function</a>()</div>
<div>A function to call once the animation is complete.</div>
</li>
</ul>
</li>
</ul>
</li>
<li class="signature">
<h4 class="name">
<span class="version-details">version added: <a href="/category/version/1.1/">1.1</a></span><a href="#jQuery-speed-duration-easing-complete" id="jQuery-speed-duration-easing-complete"><span class="icon-link"></span>jQuery.speed(  [duration ] [, easing ] [, complete ] )</a>
</h4>
<ul>
<li>
<div>
<strong>duration</strong> (default: <code>400</code>)</div>
<div>Type: <a href="http://api.jquery.com/Types/#Number">Number</a> or <a href="http://api.jquery.com/Types/#String">String</a>
</div>
<div>A string or number determining how long the animation will run.</div>
</li>
<li>
<div>
<strong>easing</strong> (default: <code>swing</code>)</div>
<div>Type: <a href="http://api.jquery.com/Types/#String">String</a>
</div>
<div>A string indicating which easing function to use for the transition.</div>
</li>
<li>
<div><strong>complete</strong></div>
<div>Type: <a href="http://api.jquery.com/Types/#Function">Function</a>()</div>
<div>A function to call once the animation is complete, called once per matched element.</div>
</li>
</ul>
</li>
<li class="signature">
<h4 class="name">
<span class="version-details">version added: <a href="/category/version/1.1/">1.1</a></span><a href="#jQuery-speed-settings" id="jQuery-speed-settings"><span class="icon-link"></span>jQuery.speed( settings )</a>
</h4>
<ul><li>
<div><strong>settings</strong></div>
<div>Type: <a href="http://api.jquery.com/Types/#PlainObject">PlainObject</a>
</div>
<div></div>
<ul>
<li>
<div>
<strong>duration</strong> (default: <code>400</code>)</div>
<div>Type: <a href="http://api.jquery.com/Types/#Number">Number</a> or <a href="http://api.jquery.com/Types/#String">String</a>
</div>
<div>A string or number determining how long the animation will run.</div>
</li>
<li>
<div>
<strong>easing</strong> (default: <code>swing</code>)</div>
<div>Type: <a href="http://api.jquery.com/Types/#String">String</a>
</div>
<div>A string indicating which easing function to use for the transition.</div>
</li>
<li>
<div><strong>complete</strong></div>
<div>Type: <a href="http://api.jquery.com/Types/#Function">Function</a>()</div>
<div>A function to call once the animation is complete.</div>
</li>
</ul>
</li></ul>
</li>
</ul>
<div class="longdesc" id="entry-longdesc">
<p>The <code>$.speed()</code> method provides a way to define properties, such as <code>duration</code>, <code>easing</code>, and <code>queue</code>, to use in a custom animation. By using it, you don't have to implement the logic that deals with default values and optional parameters.</p>
<p>This method is meant for plugin developers who are creating new animation methods. Letting <code>$.speed()</code> do all the parameter hockey and normalization for you, rather than duplicating the logic yourself, makes your work simpler. An example of use can be found in the animated form of <code>.addClass()</code> of jQuery UI. </p>
</div>
</div></article>
</article>